flatten in array php

45

$c = ["a" => ["x" => "X", "y" => "Y"], "b" => ["p" => "P", "q" => "Q"]];
print_r(array_merge(...array_values($c)));

Array
(
    [x] => X
    [y] => Y
    [p] => P
    [q] => Q
)
array_merge(...$a);
array_merge([], ...$a);
array_merge(...$a);

Comments

Submit
0 Comments